package main.strategy;

import main.robClass;
import user.IUser;

/**
 * @author bali2
 */

public enum SelectStrategyFactory {
    Register, Login, SelectPECourseList, SelectCommonCourseList, StartPERob, StartPECrazyRob, StartCommonCrazyRob, StartCommonRob, StartPERobTimer, StartCommonRobTimer, startGetLoginCookie,BackupCourseList;
    RobStrategy robStrategy;

    public void execute(IUser iUser) {
        switch (this) {
            case Register: /**注册信息*/
                robStrategy = new RegisterStrategy();
                break;
            case Login: /**登录*/
                robStrategy = new LoginStrategy();
                break;
            case SelectPECourseList: /**设置PE课程*/
                robStrategy = new SelectPECourseListStrategy();
                break;
            case SelectCommonCourseList: /**设置Common课程*/
                robStrategy = new SelectCommonCourseListStrategy();
                break;
            case StartPERob: /**开始PE抢课*/
                robStrategy = new StartPERobStrategy();
                break;
            case StartCommonRob: /**开始Common抢课*/
                robStrategy = new StartCommonRobStrategy();
                break;
            case StartPERobTimer: /**开始PE定时抢课*/
                robStrategy = new StartPERobTimerStrategy();
                break;
            case StartCommonRobTimer: /**开始Common定时抢课*/
                robStrategy = new StartCommonRobTimerStrategy();
                break;
            case startGetLoginCookie: /**获取登录Cookie*/
                robStrategy = new StartGetLoginCookie();
                break;
            case StartPECrazyRob: /**开始PE疯狂抢课*/
                robStrategy = new StartPECrazyRobStrategy();
                break;
            case StartCommonCrazyRob: /**开始Common疯狂抢课*/
                robStrategy = new StartCommonCrazyRobStrategy();
                break;
            case BackupCourseList: /**手动备份课表*/
                robStrategy = new backupCourseListStrategy();
                break;
            default:
                try {
                    throw new ClassNotFoundException("枚举策略工厂: 不支持此操作");
                } catch (ClassNotFoundException e) {
                    e.printStackTrace();
                }
        }
        //iUser = MysqlUtil.getUser(iUser);
//        robClass.logger.info("iUser" + iUser);
        try {
            robStrategy.execute(iUser);
            //showTable(iUser);
        } catch (Exception e) {
            e.printStackTrace();
        }

    }
}

